package code.rocky.chapter05;

import java.util.ArrayList;
import java.util.List;

public class Suggest70 {
    public static void main(String[] args) {
        List<String> c = new ArrayList<>();
        c.add("A");
        c.add("B");
        List<String> c1 = new ArrayList<>(c);
        List<String> c2 = c.subList(0, c.size());
        c1.add("C");
        System.out.println("c==c1 ? " + c.equals(c1)); // c==c1 ? false
        System.out.println("c==c2 ? " + c.equals(c2)); // c==c2 ? true

        String str = "AB";
        String str1 = new String(str);
        String str2 = str.substring(0) + "C";
        System.out.println("str == str1 ? " + str.equals(str1)); // str == str1 ? true
        System.out.println("str == str2 ? " + str.equals(str2)); // str == str2 ? false
    }
}
